package com.hducms.cms.entity.front;


import com.hducms.common.security.encoder.Md5PwdEncoder;
import com.hducms.common.util.RSAUtils;
import com.hducms.cms.Constants;
public class BaseResponseEntity {
	
	private String signature;
//	private String publickey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7Qn47Gu4z5h4yrUhc8cwH tOmW/P1cxPATKRJSQoMjIYsiRMwvJyAez2BF7gy2EF2x78KbIP8ntLLIU5FP kNvJ9H/P5dHFx+8G28USKAK0qnzfPgek7yRr8hEaFgrf2lyhlUfbo2mpfEYf niF1agZRfkygUBWs3kyo8FaBryRJSwIDAQAB";
	
	public String generateSignature(Object object){
		try {
			String data = new Md5PwdEncoder().encodePassword(object.toString());
			this.signature = RSAUtils.sign(data.getBytes("UTF-8"), getPrivatekey());
		} catch (Exception e) {
			System.out.println("签名失败");
			e.printStackTrace();
		}
		return signature;
	}

	private String getPrivatekey() {
		return Constants.privatekey;
	}

	public void setPrivatekey(String privatekey) {
		Constants.privatekey = privatekey;
	}
	
	public String getSignature() {
		return signature;
	}
	
}
